namespace IQIGame.Onigao.Logic
{
    public static class LgLevelConst
    {
        /// <summary>
        /// 逻辑层帧率
        /// </summary>
        public const byte FrameRate = LogicConst.FrameRate;
        /// <summary>
        /// 逻辑层帧刷时间间隔
        /// </summary>
        public static readonly float deltaTime = 1f / FrameRate;
        /// <summary>
        /// AOI刷新频率（秒）
        /// </summary>
        public const float AOIUpdateInterval = 1f;
        /// <summary>
        /// 同步移动给视图层的间隔时间
        /// </summary>
        public const float MoveSyncInterval = 0.2f;
        /// <summary>
        /// 行为树刷新时间间隔
        /// </summary>
        public const float BehaviacUpdateInterval = 0.1f;
        /// <summary>
        /// 状态机刷新时间间隔
        /// </summary>
        public const float StateMachineUpdateInterval = 0.1f;
        /// <summary>
        /// 被视为相同位置的距离方差
        /// 比如value == 400即表示：大约相距20厘米内被视为位置重合
        /// </summary>
        public const int SamePositionSqrtRange = 400;
        /// <summary>
        /// 默认交互距离（厘米）
        /// 逻辑层放宽校验范围
        /// </summary>
        public const int DefaultInteractRange = (int)(100 * 1.01f);
        /// <summary>
        /// 当和有阻挡的实体交互时，英雄和实体包围盒之间允许的最大间隙。如果英雄和实体包围盒之间的距离大于该值，不认为处于交互范围内（厘米）
        /// </summary>
        public const int InteractMaxBoundsGap = 10;
        /// <summary>
        /// 跟随距离（厘米）
        /// </summary>
        public const int FollowDistance = 100;
        /// <summary>
        /// 跟随距离的平方（厘米²）
        /// </summary>
        public const int SqrFollowDistance = FollowDistance * FollowDistance;
        /// <summary>
        /// 追击时刷新目标点的间隔（帧）
        /// </summary>
        public const int PursuitSetTargetInterval = 15;
        /// <summary>
        /// 实体移动速度
        /// </summary>
        public const int EntitySpeed = 150;
        /// <summary>
        /// Agent最大加速度
        /// </summary>
        public const int AgentMaxAcceleration = 800;
        /// <summary>
        /// 距离单位比率，Unity默认是米，如果逻辑层的单位是厘米，比率则是100
        /// </summary>
        public const int DistanceUnitRatio = 100;
        /// <summary>
        /// 实体跟随英雄的速度
        /// </summary>
        public const int EntityFollowSpeed = 200;
        /// <summary>
        /// 检测triggerRect时的y轴偏差最小量，如果高度离英雄太远，不认为处于该实体触发范围内
        /// </summary>
        public const int TriggerRectYThreshold = 30;
        /// <summary>
        /// 退出物理寻路，返回网格寻路时，离制定点（根据不同类型决定，参考LevelRegion.SwitchPhysicNavMode）多远逻辑层认为是合法的
        /// </summary>
        public const int ExitPhysicrValidSqrDistance = 200 * 200;
        /// <summary>
        /// 英雄实体半径
        /// </summary>
        public const int HeroEntityRadius = 30;
        /// <summary>
        /// 英雄实体四叉树查询范围
        /// </summary>
        public const int HeroQuadQueryHalfSize = 600;
        /// <summary>
        /// 实体寻路时，离英雄多远时不再寻路（平方）
        /// </summary>
        public const int MaxSqrDistanceFromHeroWhenNpcNav = 500 * 500;
        /// <summary>
        /// npc寻路时，如果停下来等待英雄，当英雄重新靠近时，重启需要的时间（秒）
        /// </summary>
        public const int NpcNavRestartTime = 2;
        /// <summary>
        /// 怪物追击最长距离（平方）
        /// </summary>
        public const int SqrMonsterPursueDistance = 500 * 500;
        /// <summary>
        /// 怪物一次攻击持续时间
        /// </summary>
        public const int MonsterAttackDuration = 1 * FrameRate;
        /// <summary>
        /// 传送时，Hero到传送门的距离（厘米）
        /// </summary>
        public const int TeleportDisFromPortal = 50;
        /// <summary>
        /// 生成实体到玩家附近时，实体到Hero的距离（厘米）
        /// </summary>
        public const int GenEntityFromHero = 100;
        /// <summary>
        /// AOI半径（厘米）
        /// </summary>
        public const int AOIRadius = 3000;
        /// <summary>
        /// 比AOI半径更大的删除范围，避免玩家反复横跳导致频繁删除和加载
        /// </summary>
        private const int AOIRemoveRadius = (int)(AOIRadius * 1.2f);
        /// <summary>
        /// AOI半径（厘米）的平方，半径内才通知视图层
        /// </summary>
        public const int SqrAOIRadius = AOIRadius * AOIRadius;
        /// <summary>
        /// 比AOI半径更大的删除范围（平方），避免玩家反复横跳导致频繁删除和加载
        /// </summary>
        public const int SqrAOIRemoveRadius = AOIRemoveRadius * AOIRemoveRadius;
        /// <summary>
        /// 怪物追击时超出追击范围后的等待返回的时间（帧）
        /// </summary>
        public const int PursueOutOfRangeWaitFrame = 5 * FrameRate;
        /// <summary>
        /// 编队替补开始位
        /// </summary>
        public const int FormationBenchIndexStart = 11;
        /// <summary>
        /// 被动切换队伍时，队伍的无敌时间
        /// </summary>
        public const float PassiveChangeLeaderInvincibleSec = 1;
        /// <summary>
        /// 怪物巡逻随机等待时间的最大值
        /// </summary>
        public const int PatrolRandomWaitMaxMilliSec = 3000;
        /// <summary>
        /// 怪物警戒值达到100时可以留出来的延迟启动追击的时间，用来播放一个动画(秒)
        /// </summary>
        public const float MonsterWarnDelay = 0.5f;
        /// <summary>
        /// 攻击动作的动作表(EntityAnimAction.csv)id
        /// </summary>
        public const int AttackActionID = 6;
        /// <summary>
        /// 怪物AI状态机通知播放攻击动作后几秒正式进入战斗
        /// </summary>
        public const float CFSMAttackDelay = 0.5f;
        /// <summary>
        /// 怪物追击速度比率
        /// </summary>
        public const float MonsterChaseSpeedRatio = 6f;
    }
}
